updating oE defaulted_value
defaulted_value
include get.e namespace stdget public function defaulted_value(object st, object def, integer start_point = 1)
calls the value function and returns the resulting value on success or the default default on failure.
Parameters:
- st : object to retrieve value from.
- def : the value returned if st is an atom or value(st) fails.
- start_point : an integer, the position in st at which to start getting the value from. Defaults to 1
Returns:
- If st, is an atom then def is returned.
- If calling value(st) is a success. then value()[2], otherwise it will return the parameter def.
Example 1:
object i = defaulted_value("10", 0) -- i is 10 i = defaulted_value("abc", 39) -- i is 39 i = defaulted_value(12, 42) -- i is 42 i = defaulted_value("{1,2}", 42) -- i is {1,2}
See Also:
Not Categorized, Please Help
|